package com.jf3q.front.controller;

import com.jf3q.common.vo.ResultVo;
import com.jf3q.front.service.PayLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/paylog")
public class PayLogController {

    @Autowired
    private PayLogService payLogService;


    //生成二维码的
    @GetMapping("/createNative/{orderNo}")
    public ResultVo createNative(@PathVariable String orderNo) {
        //返回信息，包含二维码地址，还有其他需要的信息
        Map map = payLogService.createNatvie(orderNo);
        System.out.println("****返回二维码map集合:"+map);
        return ResultVo.success(map);
    }

    //查询订单支付状态
    //参数：订单号，根据订单号查询 支付状态
    @GetMapping("/queryPayStatus/{orderNo}")
    public ResultVo queryPayStatus(@PathVariable String orderNo) {
       payLogService.queryPayStatus(orderNo);
       return ResultVo.success();

    }
}
